﻿namespace AgileBoard.Domain
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using Iesi.Collections.Generic;
    using SharpArch.Core.DomainModel;

    [Serializable]
    public class Task //: Entity
    {
        private ISet<Actual> _actuals = new HashedSet<Actual>();

        /// <summary>
        /// Created Date
        /// </summary>
        public virtual DateTime CreateTime { get; set; }

        /// <summary>
        /// Created by
        /// </summary>
        public virtual string Creator { get; set; }

        /// <summary>
        /// Task ID
        /// </summary>
        public virtual Guid TaskID { get; set; }

        /// <summary>
        /// Actuals ID
        /// </summary>
        public virtual Story Story { get; set; }

        /// <summary>
        /// Task Status
        /// </summary>
        public virtual Status Status { get; set; }

        /// <summary>
        /// Iteration ID
        /// </summary>
        public virtual string IterationID { get; set; }

        /// <summary>
        /// Task name
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// color
        /// </summary>
        public virtual string Color { get; set; }

        /// <summary>
        /// Task size
        /// </summary>
        public virtual Double Remaining { get; set; }

        /// <summary>
        /// Task size
        /// </summary>
        public virtual Double Evaluation { get; set; }

        /// <summary>
        /// Task size
        /// </summary>
        public virtual Double Beyond { get; set; }

        /// <summary>
        /// Is initial task
        /// </summary>
        public virtual bool Primary { get; set; }


        /// <summary>
        /// assigned to 
        /// </summary>
        public virtual User AssignedTo { get; set; }

        /// <summary>
        /// Create date
        /// </summary>
        public virtual DateTime? CreateDate { get; set; }

        /// <summary>
        /// Create date
        /// </summary>
        public virtual DateTime? StartDate { get; set; }

        /// <summary>
        /// Create date
        /// </summary>
        public virtual DateTime? FinishDate { get; set; }

        /// <summary>
        /// Create date
        /// </summary>
        public virtual DateTime? Target { get; set; }


        /// <summary>
        /// tag
        /// </summary>
        public virtual string Card { get; set; }

        /// <summary>
        /// Full size
        /// </summary>
        public virtual string Observations { get; set; }

        public virtual ReadOnlyCollection<Actual> Actuals
        {
            get { return new List<Actual>(_actuals).AsReadOnly(); }
        }

        public virtual void AddActual(Actual actual)
        {
            actual.TaskID = TaskID.ToString();
            _actuals.Add(actual);
        }

        public virtual void RemoveActual(Actual n)
        {
        }
    }
}